/* =========================================
			
		FCNPC - Fully Controllable NPC
			----------------------

	- File: Address.cpp
	- Author(s): OrMisicL

  =========================================*/


#include "Main.h"

// Callbacks
DWORD CAddress::CALLBACK_CFilterScriptPool__OnPlayerGiveDamage = NULL;

// Functions
DWORD CAddress::FUNC_CreateNPC_RPC = NULL;
DWORD CAddress::FUNC_CPlayerPool__DeletePlayer = NULL;

DWORD CAddress::FUNC_CPlayer__SpawnForWorld = NULL;
DWORD CAddress::FUNC_CPlayer__Kill = NULL;
DWORD CAddress::FUNC_CPlayer__EnterVehicle = NULL;
DWORD CAddress::FUNC_CPlayer__ExitVehicle = NULL;

DWORD CAddress::FUNC_CConfig__GetValueAsInteger = NULL;

DWORD CAddress::FUNC_GetVehicleModelInfo = NULL;

DWORD CAddress::FUNC_CFilterScriptPool__OnPlayerGiveDamage = NULL;

// Variables
DWORD CAddress::VAR_ServerPtr = NULL;
DWORD CAddress::VAR_ConfigPtr = NULL;
DWORD CAddress::VAR_RakPeerPtr = NULL;
DWORD CAddress::VAR_ServerAuthentication = NULL;

void CAddress::Initialize(eSAMPVersion sampVersion)
{
	switch(sampVersion)
	{
		case SAMP_VERSION_03Z:
		{
			// Initliaze addresses
#ifdef _WIN32
			// Initialize callbacks
			CALLBACK_CFilterScriptPool__OnPlayerGiveDamage  =   0x46B9A0;

			FUNC_CPlayerPool__DeletePlayer					=	0x465F90;
			FUNC_CFilterScriptPool__OnPlayerGiveDamage		=	0x46B9A0;
			FUNC_CPlayer__Kill								=	0x4806D0;
			FUNC_CPlayer__EnterVehicle						=	0x480C40;
			FUNC_CPlayer__ExitVehicle						=	0x480D60; //
			FUNC_CPlayer__SpawnForWorld						=	0x482CC0;
			FUNC_GetVehicleModelInfo						=	0x4841D0;
			FUNC_CConfig__GetValueAsInteger					=	0x4859F0;
			FUNC_CreateNPC_RPC								=	0x48BA40;
 		
			VAR_ServerPtr									=	0x4F234C;
			VAR_ConfigPtr									=	0x4F2350;
			VAR_RakPeerPtr									=	0x4F24A4;
			VAR_ServerAuthentication						=	0x4F2340;
			
#else
			// Credits to Lorenc_
			CALLBACK_CFilterScriptPool__OnPlayerGiveDamage  =	0x80A1F00;

			FUNC_CPlayerPool__DeletePlayer                  =   0x80CDB70;
			FUNC_CreateNPC_RPC                              =   0x80ADE60;
			FUNC_CPlayer__SpawnForWorld                     =   0x80CA460;
			FUNC_CPlayer__Kill                              =   0x80C8940;
			FUNC_CPlayer__EnterVehicle                      =   0x80C9660;
			FUNC_CPlayer__ExitVehicle                       =   0x80C97E0;
			FUNC_CConfig__GetValueAsInteger                 =   0x809ED10;
			FUNC_GetVehicleModelInfo                        =   0x80D2D20;
			FUNC_CFilterScriptPool__OnPlayerGiveDamage      =   0x80A2780;

			VAR_ServerPtr                                   =   0x819A568;
			VAR_ConfigPtr                                   =   0x819A564;
			VAR_RakPeerPtr                                  =   0x819A6A8;
			VAR_ServerAuthentication                        =   0x819A548;
#endif
			break;
		}
	}
}